package router

import (
	"KumquatDrivesServices/api"
	"github.com/gin-gonic/gin"
)

func ApiRouterInit(r *gin.Engine) {
	apiRouter := r.Group("/api")
	apiRouter.POST("/refreshToken", api.ApiGruopApp.RefreshToken)
	AuthRouterInit(apiRouter)
	{
		apiRouter.POST("/user/login", api.ApiGruopApp.UserModuleApi.UserLogin)
		apiRouter.POST("/user/register", api.ApiGruopApp.UserModuleApi.UserRegistered)
	}
	{
		apiRouter.GET("/file/getCoverImage/:filePath", api.ApiGruopApp.UserFileModuleApi.GetCoverImage)
		apiRouter.GET("/file/getPreviewFile/:previewId/:fileName", api.ApiGruopApp.UserFileModuleApi.GetPreviewFile)
		apiRouter.GET("/file/download/:code", api.ApiGruopApp.UserFileModuleApi.DownLoad)
	}
	//外部分享模块
	{
		shareApi := api.ApiGruopApp.UserShareModuleApi
		shareRouter := apiRouter.Group("/share")
		shareRouter.GET("/getShareInfo/:shareId", shareApi.GetShareInfo)
		shareRouter.GET("/getShareFileList/:shareId/:filePid", shareApi.GetShareFileList)
		shareRouter.GET("/getShareDownLoadCode", shareApi.GetShareDownLoadCode)
		shareRouter.GET("/ShareDownload/:code", shareApi.ShareDownload)
		shareRouter.POST("/checkShareCode", shareApi.CheckShareCode)
	}
}
